#include "extralib.h"

#include <cstring>

t_Messages g_Messages;

struct t_MessageTable
{
	int *ID;
	const char *Name;
}
g_MessageTable[] = 
{
	{&g_Messages.ShowMenu, "ShowMenu"},
	{nullptr, nullptr}
};

void OnAmxxAttach()
{
	MF_AddNatives(MenuNode::ExportNatives);
}

void OnPluginsLoaded()
{
	//// PLACEHOLDER
}

void OnPluginsUnloading()
{
	//// PLACEHOLDER
}

void OnPluginsUnloaded()
{
	//// PLACEHOLDER
}

void OnAmxxDetach()
{
	//// PLACEHOLDER
}

void hook_ClientCommand(edict_t *pEntity)
{
	MenuNode::hook_ClientCommand(pEntity);
}

void hook_PlayerPostThink(edict_t *pEntity)
{
	MenuNode::hook_PlayerPostThink(pEntity);
}

int hook_RegUserMsg_Post(const char *pszName, int iSize)
{
	for(int index = 0; g_MessageTable[index].Name; index++)
	{
		if(!strcmp(pszName, g_MessageTable[index].Name))
		{
			*(g_MessageTable[index].ID) = META_RESULT_ORIG_RET(int);
			break;
		}
	}
	RETURN_META_VALUE(MRES_IGNORED, 0);
}